/*
                    KeyBindings Class Implementation
*/
#include "KeyBindings.h"

map<int, string> KeyBindings::Keylist = map<int, string>();

// Default key bindings
void KeyBindings::Initialise()
{
    // Player 1
    Keylist[KB_UP]          = "up";
    Keylist[KB_DOWN]        = "down";
    Keylist[KB_LEFT]        = "left";
    Keylist[KB_RIGHT]       = "right";
}

void KeyBindings::FreeKeys()
{
    Keylist.clear();
}

int KeyBindings::GetKeyFromName(const string& strName)
{
    for (map<int, string>::iterator iter = Keylist.begin(); iter != Keylist.end(); iter++)
    {
        if (iter->second == strName)
        {
            return iter->first;
        }
    }

    return KB_UNRECOGNISED;
}
